<?php

namespace app\api\controller;

use app\common\controller\Api;

/**
 * 示例接口
 */
class Banner extends Api
{

    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['*'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = [];

    /**
     * 轮播图列表
     */
    public function list(){
        $pos = $this->request->param('pos');
        if(!$pos){
            $this->error("请指定位置后重新提交");
        }
        $where['show_switch'] = 1;
        $where['pos'] = $pos;
        $fields = "id,title,subtitle,type,pos,url,images";
        $res = db('banner')->where($where)
            // ->whereTime('stime','<=',time())
            // ->whereTime('etime','>=',time())
            ->field($fields)
            ->select();
        $this->success('OK', $res);
    }

}
